using System;
using System.Collections.Generic;
using System.Text;
using NBusiness.Data;
using NBusiness.Properties;

namespace NBusiness.CodeDom
{
    [Serializable]
    [AttributeUsage(AttributeTargets.Class)]
    public class ExpectedArgumentTypeAttribute : Attribute
    {
        private Type _argumentType;

        public Type ArgumentType
        {
            get { return _argumentType; }
            set { _argumentType = value; }
        }

        public ExpectedArgumentTypeAttribute(Type argumentType)
        {
            if (!typeof(ValidationEventArgs).IsAssignableFrom(argumentType))
                throw new ArgumentException(Resources.ExpectedArgumentTypeInvalid, "argumentType");

            _argumentType = argumentType;
        }
    }
}
